package gaileenchess.tests;
import gaileenchess.*;

public class CommonTest extends Test
{
    public CommonTest()
    {
        super("Common");
    }
    
    protected boolean doTests()
    {
        return test1();
    }
    
    private boolean test1()
    {
        boolean pass = true;
        
        Board.Position p1 = Common.stringToPos("a1");
        Board.Position p2 = new Board.Position(0, 0);
        pass &= (p1.row == p2.row && p1.column == p2.column);
        p1 = Common.stringToPos("h8");
        p2 = new Board.Position(7, 7);
        pass &= (p1.row == p2.row && p1.column == p2.column);
        p1 = Common.stringToPos("e4");
        p2 = new Board.Position(3, 4);
        pass &= (p1.row == p2.row && p1.column == p2.column);
        p1 = Common.stringToPos("d7");
        p2 = new Board.Position(6, 3);
        pass &= (p1.row == p2.row && p1.column == p2.column);
        p1 = Common.stringToPos("i1");
        pass &= (p1 == null);
        p1 = Common.stringToPos("a0");
        pass &= (p1 == null);
        p1 = Common.stringToPos("a9");
        pass &= (p1 == null);
        
        printSuccess(pass, "test1");
        
        return pass;
    }
}
